package id.co.rho.scoring.cid.shared.utils;

import id.co.rho.scoring.cid.client.widgets.DirtyAwareComboBox;

import com.extjs.gxt.ui.client.widget.form.Field;
import java.util.Comparator;

import com.extjs.gxt.ui.client.binding.FieldBinding;

public class DirtyAwareComboBoxPriorityComparator implements Comparator<FieldBinding> {

	@Override
	public int compare(FieldBinding o1, FieldBinding o2) {
		Field f1 =  o1.getField();
		Field f2 =  o2.getField();
		DirtyAwareComboBox combo1 = (DirtyAwareComboBox)f1;
		DirtyAwareComboBox combo2 = (DirtyAwareComboBox)f2;
		Integer p1 = combo1.getPriority();
		Integer p2 = combo2.getPriority();
		return p1.compareTo(p2);
	}

}
